<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>微信安全支付</title>
</head>
<body>
<% 
   

%>
</body>
<script type="text/javascript">  
  
        //调用微信JS api 支付  
        function jsApiCall()  
        {  
            WeixinJSBridge.invoke(  
                'getBrandWCPayRequest',  
                {   //公众号名称，由商户传入
                	"appId" : "wx2421b1c4370ec43b",
                	//时间戳，自1970年以来的秒数
                	"timeStamp":" 1395712654",
                	//随机串
                	"nonceStr" : "e61463f8efa94090b1f366cccfbbb444",
                	//prepay_id为微信统一下单返回的结果
                	"package" : "prepay_id=u802345jgfjsdfgsdg888",
                	//微信签名方式
                	"signType" : "MD5",
                	//微信签名
                	"paySign" : "70EA570631E4BB79628FBCA90534C63FF7FADD89"
                },  
                function(res){//使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。 
                    //alert(res.err_code+' >> '+res.err_desc+' >> '+res.err_msg);  
                    if(res.err_msg == "get_brand_wcpay_request:ok"){  
                        window.location.href = '';//支付成功跳转url  
                    }else 
                    	window.location.href = '';  //支付失败跳转url  
                }  
            );  
        }  
  
        function callpay()  
        {  
            if (typeof WeixinJSBridge == "undefined"){  
                if( document.addEventListener ){  
                    document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);  
                }else if (document.attachEvent){  
                    document.attachEvent('WeixinJSBridgeReady', jsApiCall);   
                    document.attachEvent('onWeixinJSBridgeReady', jsApiCall);  
                }  
            }else{  
                jsApiCall();  
            }  
        }  
        setTimeout('callpay()',1000);  
    </script>  
</head>  
<body>  
    <br/><br/><br/>  
    <input type="hidden" id="openId" value="${opneId}">
    <input type="hidden" id="body" value="${body}">
    <input type="hidden" id="out_trade_no" value="${out_trade_no}">
    <input type="hidden" id="out_trade_no" value="${ }">
    <div align="center">  
        正在跳转...  
        <!--  <button style="width:210px; height:30px; background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer;  color:white;  font-size:16px;" type="button" onclick="callpay()" >贡献一下</button>-->  
    </div> 

</html>